import 'dart:typed_data';

import 'package:cloudapp/esdk/esync.dart';
import 'package:flutter/foundation.dart';
import 'package:photo_manager/photo_manager.dart';

class UploadTask {
  final int serverAlbumId;
  // 本地相册编号
  final String localAlbumId;
  final AssetEntity file;
  final ESync esync;
  final AssetType type;
  Uint8List videoThumb;

  UploadTask({@required this.serverAlbumId,
    @required this.localAlbumId,
    @required this.file,
    @required this.esync,
    @required this.type,
    this.videoThumb,
  });
}

class AlbumWithServerID {
  final int serverId;
  final AssetPathEntity album;

  AlbumWithServerID({@required this.serverId, @required this.album});
}

enum SyncStatus {
  Finished,
  Running,
  Paused,
}

enum FileType {
  Picture,
  Video,
  Audio,
  Document,
  Other,
}

class UploadFileInfo {
  final int userId;
  final int sessionId;
  final int serverAlbumId;
  final String localAlbumId;
  final String localFileId;
  final String token;
  final String baseHost;
  final String fileName;
  final String filePath;
  final FileType type;
  Uint8List videoThumb;

  UploadFileInfo({
    @required this.userId,
    @required this.sessionId,
    @required this.serverAlbumId,
    @required this.localAlbumId,
    @required this.localFileId,
    @required this.token,
    @required this.baseHost,
    @required this.fileName,
    @required this.filePath,
    @required this.type,
    this.videoThumb,
  });
}

enum UploadResult {
  UploadSucceed,
  UploadFailed,
}

class UploadFileResult {
  final int sessionId;
  final int fileId;
  final String fileHash;
  final String localFileId;
  final String localAlbumId;
  final String fileName;
  final UploadResult result;

  UploadFileResult({
    @required this.sessionId,
    @required this.fileId,
    @required this.fileHash,
    @required this.localFileId,
    @required this.localAlbumId,
    @required this.fileName,
    @required this.result,
  });
}

class UploadTaskResult {
  String localFileId;
  int fileId;
}